/*
 * Copyright (C) 2009 - 2010 TrinityCore <http://www.trinitycore.org/>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#include "ScriptPCH.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellAuraEffects.h"
#include "ruby_sanctum.h"

enum Texts
{
	SAY_DEATH						= 1,
	SAY_COMBAT						= 2,
	SAY_KILL						= 3,
};


class boss_Halion : public CreatureScript
{
	public:
		boss_Halion() : CreatureScript("boss_Halion") { }
		struct boss_HalionAI : BossAI
		{
			boss_halionAI(Creature* creature) : BossAI(creature,  DATA_HALION)
			{
			}

			void Reset()
			{
				BossAI::Reset();
				me->SetReactState(REACT_DEFENSIVE);
			}

			void JustDied(Unit* killer)
			{
				BossAI::JustDied(killer);
				Talk(SAY_DEATH);
			};

			void EnterCombat(Unit* victim)
			{
				 if (!instance->CheckRequiredBosses(DATA_HALION, victim->ToPlayer()))
                {
                    EnterEvadeMode();
                }
					 BossAI::EnterCombat(victim);
					 Talk(SAY_COMBAT);
			}

			void JustReachedHome()
            {
                BossAI::JustReachedHome();
                instance->SetBossState(DATA_HALION, FAIL);
			}

			void KilledUnit(Unit* victim)
			{
				if (victim->GetTypeId() == TYPEID_PLAYER)
                    Talk(SAY_KILL);
				}

			void UpdateAI(uint32 const diff)
			{
                if (!UpdateVictim() || !CheckInRoom())
                    return;

        }

				DoMeleeAttackIfReady();
			}

		};

		CreatureAI* GetAI(Creature* creature) const
        {
            return GetRubySanctumAI<boss_halionAI>(creature);
        }
};
void AddSC_boss_halion()
{
	new boss_halion();
};


